package com.ktjiaoyu.crm.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ktjiaoyu.crm.dao.UserDao;
import com.ktjiaoyu.crm.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UserServiceImpl  implements UserService{
    @Resource
    private UserDao userDao;
    @Override
    public User login(String usrName, String usrPassword) {
        QueryWrapper wq = new QueryWrapper();
        wq.eq("usr_name",usrName);
        wq.eq("usr_password",usrPassword);
        User user = userDao.selectOne(wq);

        return user;
    }
    @Override
    public int addUser(User user) {
        int insert = userDao.insert(user);
        return insert;
    }
    @Override
    public int deleteUser(Long usrId) {
        return 0;
    }

    @Override
    public int updateUser(User user) {
        return 0;
    }

    @Override
    public User getUser(Long usrId) {
        return userDao.selectById(usrId);
    }

    @Override
    public List<User> findAllUsers() {
        return userDao.selectList(null);
    }
}
